/*
 * @Author: LAB
 * @Date: 2021-03-29 18:08:21
 * @Description: 静态字典
 * @FilePath: \Clinic-Web\clientapp\src\utils\static-data.ts
 */
export interface ConfirmOption {
  /** 后端key值 */
  key?: string | undefined;
  /** 展示标题  */
  value?: string | undefined;
}
class StaticData extends Map {
  constructor() {
    super();
  }

  data = {
    hosp: new Map([
      [1, "公立医院"],
      [2, "非公立医疗机构"],
      [3, "民营医疗机构"],
      [4, "诊所"],
      [5, "其它"],
    ]),
    hospGrade: new Map([
      [1, "三级甲等"],
      [2, "三级乙等"],
      [3, "三级医院"],
      [4, "二级甲等"],
      [5, "二级乙等"],
      [6, "二级医院"],
      [7, "一级医院"],
      [8, "未评级"],
      [9, "其它"],
    ]),
    financial: new Map([
      [1, "国有银行"],
      [2, "商业银行"],
      [3, "互联网金融"],
      [4, "其它"]
    ]),
    institutiontype: new Map([
      [1, "管理机构"],
      [2, "民营机构"],
    ]),
    examine: new Map([
      [1, "正在审核"],
      [3, "审核通过"],
      [2, "补充资料"],
      [4, "未通过"]
    ]),
    productUpDown: new Map([
      [1, "未上架"],
      [2, "已上架"]
    ])
  }
  /**
   * @Author: LAB
   * @description: MAP 转 数组
   * @param {*} data
   * @param {ConfirmOption} options 
   * @return {*}
   */
  getKVArray = function (data = this, options: ConfirmOption = {}) {
    let { key = "value", value = "label" } = options;
    let result = [];
    data.forEach((word, i) => {
      let item = {}
      item[key] = i
      item[value] = word
      result.push(item)
    });
    return result
  }
  // 获取指定Map
  getMap = function (key) {
    if (!this.data[key]) {
      return null;
    }
    return this.data[key];
  }
}
export default new StaticData()
